// src/api/pattern.js
import request from "@/utils/request.js";

// 获取规则列表
export function getPatternList(params) {
    return request({
        url: `rule/api/pattern/list`,
        method: 'get',
        params
    })
}

// 添加规则
export function addPattern(data) {
    return request({
        url: `rule/api/pattern`,
        method: 'post',
        data
    })
}

// 更新规则
export function updatePattern(id, data) {
    return request({
        url: `rule/api/pattern/${id}`,
        method: 'put',
        data
    })
}

// 删除规则
export function deletePattern(id) {
    return request({
        url: `rule/api/pattern/${id}`,
        method: 'delete'
    })
}

// 刷新缓存
export function refreshCache() {
    return request({
        url: `rule/api/pattern/refresh-cache`,
        method: 'post'
    })
}

export function updatePatternStatus(ids,enabled) {
    return request({
        url: `rule/api/pattern/batch/status`,
        method: 'post',
        data: { ids, enabled }
    })
}

export function deletePatternBatch(data) {
    return request({
        url: `rule/api/pattern/batch/delete`,
        method: 'post',
        data
    })
}